package people;

import blackjack.Card;
import blackjack.Deck;
import blackjack.Hand;

public class Person {
    Hand hand; //玩家手牌
    int bestPoint = 0;   //当前最优点数
    boolean busted = false; //是否爆牌

    public Person() {    //生成函数
        this.hand = new Hand();
        this.bestPoint = 0;
        this.busted = false;
    }

    public boolean addCard(Card x) {    //向手牌中添加卡，更新最优点数和是否爆牌，返回是否爆牌
        this.hand.addCard(x);
        this.bestPoint = this.hand.calculatePoints();
        this.busted = this.hand.isBusted();
        return busted;
    }

    public Hand getHand(){    //获取手牌
        return this.hand;
    }

    public int emptyHand() {  //清空玩家手牌
        this.hand = new Hand();
        this.busted = false;
        this.bestPoint = 0;
        return 0;
    }

    public int getBestPoint() {     //获取当前最佳点数
        return this.bestPoint;
    }

    public boolean getBusted() {    //获取是否爆牌
        return this.busted;
    }

    public int getTwoCards(Deck myDeck){ //获取两张初始牌（更新最优点数与爆牌情况）
        this.addCard(myDeck.drawCard());
        this.addCard(myDeck.drawCard());
        return 0;
    }
}
